#include <iostream>
#include<vector>
using namespace std;
int getfive(int num)
{
    int ret = 0;
    while(num%5 == 0)
    {
        num /=5;
        ret++;
    }
    return ret;
}
int gettwo(int num)
{
    int ret = 0;
    while(num%2 == 0)
    {
        num/=2;
        ret++;
    }
    return ret;
}
using ll = long long;
int main() {
    int n,k;
    cin>>n>>k;
    vector<ll> arr(n);
    vector<ll> five(n);
    vector<ll> two(n);
    for(int i = 0;i<n;i++)
    {
        cin>>arr[i];
        five[i] = getfive(arr[i]);
        two[i] = gettwo(arr[i]);
    }     
    vector<ll> prevtwo(n);
    prevtwo[0] = two[0];
    vector<ll> prevfive(n);
    prevfive[0] = five[0];
    for(int i = 1;i<n;i++)
    {
        prevfive[i] = prevfive[i-1]+five[i];
        prevtwo[i] = prevtwo[i-1]+two[i];
    }
    if(prevtwo[n-1]<k||prevfive[n-1]<k)
    {
        cout<<0<<endl;
        return 0;
    }
    ll sumtwo = prevtwo[n-1];
    ll sumfive = prevfive[n-1];
    ll targettwo = sumtwo - k;
    ll targetfive = sumfive - k;
    ll count = 0;
    ll curfive = 0;
    ll curtwo = 0;
    for(ll right = 0,left = 0;right<n;right++)
    {
        curfive += five[right];
        curtwo += two[right];
        while(left<=right&&(curfive>targetfive||curtwo>targettwo))
        {
            curfive-=five[left];
            curtwo-=two[left++];
        }
        count+=right-left+1;
    }
    cout<<count<<endl;
    return 0;
}
// 64 位输出请用 printf("%lld")